package org.tomale.id.gis.renderers;

import java.awt.Point;

import javax.media.opengl.GL;

import org.tomale.id.gis.IRenderer;
import org.tomale.id.gis.MapElement;
import org.tomale.id.gis.elements.PointElement;

import com.vividsolutions.jts.geom.Coordinate;

public class PointRenderer implements IRenderer {

	@Override
	public String getName() {
		return "PointRenderer";
	}

	@Override
	public String getType() {
		return PointElement.class.toString();
	}

	@Override
	public void render(final GL gl, final MapElement element) {
		if(element instanceof PointElement){
			PointElement elem = (PointElement) element;
			
			gl.glBegin(GL.GL_POINT);
			
			// size of point in pixels
			gl.glPointSize(2);
			
			Coordinate p = elem.getPoint().getCoordinate();
			gl.glVertex3d(p.x,p.y,p.z);
			
			gl.glEnd();
		}
	}

}
